package com.beiing.tianshuai.tianshuai.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.CodeBean;
import com.beiing.tianshuai.tianshuai.entity.VersionInfoBean;
import com.beiing.tianshuai.tianshuai.model.MainModel;
import com.beiing.tianshuai.tianshuai.model.MainModelImpl;
import com.beiing.tianshuai.tianshuai.view.MainViewImpl;

/**
 * Created by Jinni on 2017/11/24 0024
 */

public class MainPresenter extends BasePresenter implements MainPresenterImpl, MainModel.OnMainResponseListener {

    private MainViewImpl mView;
    private MainModelImpl mModel;

    public MainPresenter(MainViewImpl view) {
        mView = view;
        mModel = new MainModel(this);
    }

    @Override
    public void getVersionInfo() {
        mModel.getVersionInfo();
    }

    @Override
    public void getLoginState(String uid) {
        mModel.getLoginState(uid);
    }

    @Override
    public void onGetVersionInfoSuccess(VersionInfoBean bean) {
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.onRequestFailed(throwable);
    }

    @Override
    public void onGetLoginStateSuccess(CodeBean bean) {
        mView.getLoginState(bean);
    }
}
